/*
 *
 * C++ MaJiang for 血流红中
 *
 * TuyooGame, 2021
 * zhouxin@tuyoogame.com
 *
 */
#ifndef __MAJIANG_DEFINE__
#define __MAJIANG_DEFINE__
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fstream>
#include <iostream>
#include <vector>
#include <set>

#include "mjdata.h"

using namespace std;

#define DEBUG_MJ 0

typedef struct mj_counter {
    uint8_t n;
    uint8_t bucket[40];
    uint8_t bucket_len;
} MJ_COUNTER;

typedef enum mj_tile_type : uint8_t {
    WAN, 
    TIAO,
    TONG,
    FENG,
    JIAN,
    INVAILD
} MJ_TILE_TYPE;

typedef enum mj_cpg_type : uint8_t {
    CHI,
    PENG,
    GANG
} MJ_CPG_TYPE;

typedef enum mj_cpg_subtype : uint8_t {
    AN_GANG,
    BU_GANG,
    DIAN_GANG,
    CPG_NA
} MJ_CPG_SUBTYPE;

//注意，com中用0表示牌的张数
//对于吃碰牌，一定要把com[3]置0
typedef struct mj_cpg {
    uint8_t tile;
    uint8_t com[4];
    int8_t  from_seat;
    MJ_CPG_TYPE type;
    MJ_CPG_SUBTYPE subtype;
} MJ_CPG;

typedef struct mj_cpg_info {
    MJ_CPG cpgs[4];
    uint8_t count;
} MJ_CPG_INFO;

typedef enum mj_hu_type : uint8_t {
    DIAN_PAO,
    ZI_MO,
    UNKNOWN
} MJ_HU_TYPE;

typedef union mj_fx_retdata {
    struct {
        int8_t  ret;
        uint8_t data[7];
    };
    uint64_t retdata;
} MJ_FX_RET; 

#endif
